<template>
  <div class="app-container">
    <el-card class="box-card">
      <!-- 搜索区域 -->
      <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="100px">
        <el-form-item label="出库单号" prop="issueNo">
          <el-input v-model="queryParams.issueNo" placeholder="请输入出库单号" clearable size="small" />
        </el-form-item>
        <el-form-item label="铺货单号" prop="distributeNo">
          <el-input v-model="queryParams.distributeNo" placeholder="请输入铺货单号" clearable size="small" />
        </el-form-item>
        <el-form-item label="门店" prop="store">
          <el-select v-model="queryParams.store" placeholder="请选择门店" clearable size="small">
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item>
        <el-form-item label="出库状态" prop="status">
          <el-select v-model="queryParams.status" placeholder="请选择出库状态" clearable size="small">
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
        </el-form-item>
      </el-form>

      <!-- 操作按钮区域 -->
      <el-row :gutter="10" class="mb8">
        <el-col :span="1.5">
          <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
        </el-col>
      </el-row>

      <!-- 数据表格 -->
      <el-table v-loading="loading" :data="tableData">
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column label="出库单号" align="center" prop="issueNo" />
        <el-table-column label="铺货单号" align="center" prop="distributeNo" />
        <el-table-column label="门店" align="center" prop="store" />
        <el-table-column label="出库仓库" align="center" prop="warehouse" />
        <el-table-column label="出库状态" align="center" prop="status" />
        <el-table-column label="创建时间" align="center" prop="createTime" width="180" />
        <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
            <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>

      <!-- 分页 -->
      <pagination
        v-show="total>0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />
    </el-card>
  </div>
</template>

<script>
export default {
  name: 'DistributeIssue',
  data() {
    return {
      // 遮罩层
      loading: false,
      // 总条数
      total: 0,
      // 表格数据
      tableData: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        issueNo: undefined,
        distributeNo: undefined,
        store: undefined,
        status: undefined
      }
    }
  },
  created() {
    this.getList()
  },
  methods: {
    /** 查询列表 */
    getList() {
      this.loading = true
      // TODO: 调用接口获取数据
      setTimeout(() => {
        this.loading = false
      }, 1000)
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm")
      this.handleQuery()
    },
    /** 新增按钮操作 */
    handleAdd() {
      // TODO: 实现新增逻辑
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      // TODO: 实现修改逻辑
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      // TODO: 实现删除逻辑
    }
  }
}
</script>

<style scoped>
.app-container {
  padding: 20px;
}
</style> 